package mcia_administrative;

import java.io.File;
import javax.swing.filechooser.*;

/**
 * MyCustomFilter.java - filter for file chooser that allow only image files (jpg,gif,png)
 * @author MCIA
 */
public class MyCustomFilter extends FileFilter {

    @Override
    public boolean accept(File file) {
        //allow only directories, or files with ".jpg", ".gif", ".png" extension
        return file.isDirectory() || file.getAbsolutePath().endsWith(".jpg") || file.getAbsolutePath().endsWith(".gif") || file.getAbsolutePath().endsWith(".png");
    }

    @Override
    public String getDescription() {
        //this description will be displayed in the dialog,
        return "Images (*.jpg, *.png, *.gif)";
    }
}
